<template>
  <div id="teamlist"> 


          <el-table :data="datalist" style="width: 100%" :height="dtheight" :header-cell-style="{background:'#4F81BC',color:'white'}"
           :row-class-name="tableRowClassName"  :border="true">

                <el-table-column label="注册时间"  align='center' width="200px">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.register_time }}</span>
                    </template>
                </el-table-column>
                 <el-table-column label="团长类别"  align='center' width="200px">                   
                    <template slot-scope="scope">                   
                        <span v-if="scope.row.vice_leader==1">虚拟团长</span>
                         <span v-if="scope.row.leader==1">实际</span>
                    </template>
                </el-table-column>
                <el-table-column label="账号"  align='center' width="200">                   
                    <template slot-scope="scope">                   
                         <span style="display: flex;align-items: center;justify-content: center;">
                                 {{ scope.row.telphone }}
                                <img src="@/assets/images/a9.png" style="width:18px;height:20px;margin-left:5px;" @click="goinforpersonal(scope.row,scope.row.telphone)"/>
                            </span>  
                    </template>
                </el-table-column>
                 <el-table-column label="用户名"  align='center' width="200">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.nickname }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="极差等级"  align='center' width="150px">                   
                    <template slot-scope="scope"> 
                          <span v-if="scope.row.grade">{{ scope.row.grade }}</span>  
                          <span v-else>暂无</span>     
                    </template>
                </el-table-column>
                <el-table-column label="运营中心"  align='center' width="200px">                   
                    <template slot-scope="scope">                       
                        <span v-if="scope.row.center">{{ scope.row.center.name }}</span>
                         <span v-else>暂无</span>
                    </template>
                </el-table-column>
                <el-table-column label="好友数"  align='center' width="200px">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.direct_invite_count}}</span>
                    </template>
                </el-table-column>
                <el-table-column label="团队数"  align='center' width="200px">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.sub_invite_count }}</span>
                    </template>
                </el-table-column>
                <el-table-column label="贡献值"  align='center' width="200px">                   
                    <template slot-scope="">                   
                        <span >暂无</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column label="邀请码"  align='center' width="200">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.invite_code }}</span>
                    </template>
                </el-table-column>


                <el-table-column :label="variable_name2 + '券数量'"  align='center' width="100">                   
                    <template slot-scope="scope">                   
                        <span >{{ scope.row.ticket_number }}</span>
                    </template>
                </el-table-column> -->



                 <el-table-column label="团队数据"  align='center' >                   
                    <template slot-scope="scope">                   
                        <span @click="tj_but(scope.row)">详情</span>
                    </template>
                </el-table-column>

                    
 
                 <el-table-column label="操作" align='center' width="400px" fixed="right">
                    <template slot-scope="scope">
                        <el-button size="mini"  type="primary" class="button_class1" plain @click="go_but_1(scope.row)">分配</el-button>
                         <el-button size="mini"  type="primary" class="button_class2"  plain  @click="go_but_2(scope.row)">分配详情</el-button>  
                        <el-button size="mini"  type="primary"  class="button_class1" plain @click="gogm_but(scope.row)">{{ variable_name1 }}调控</el-button> 
                         <el-button size="mini"  type="primary"  class="button_class2" plain @click="set_but(scope.row)">密码设置</el-button>
                        <!-- <el-button size="mini"  type="primary"  plain @click="gofp_but(scope.row)">庄园分配</el-button>  -->
                    </template>
                </el-table-column>
  
            </el-table>  


             <!-- 外连接 -->
        <el-dialog title="新增统计" :visible.sync="mtk1"  width="400px" class="iphone">
            <div class="iphone_box" style="width:100%;height:650px;padding: 10px;box-sizing: border-box;"> 

               <iframe :src="statistics_page" width="100%" height="100%" style="border: 0"></iframe>

            </div> 
        </el-dialog>

        <el-dialog title="密码设置" :visible.sync="paw_mtk"  width="300px" >    
            <div style="display: flex;justify-content: space-around;padding:30px 0px;">
                <el-button size="mini"  type="primary"  plain class="button_class1"   @click="xg_mm_but()">重置密码</el-button>
                <el-button size="mini"  type="primary"  plain class="button_class2"  @click="xg_ej_but()">二级密码</el-button>
            </div>
   </el-dialog>


   </div>
</template>

<script>

export default {
   name: 'teamlist',
   props:{
      datalist:{  
        //type:Array,
       default:()=>[]
     },
  },
  data () {
    return {
        dtheight:'500',  //窗口高度
        uid:'',
        mtk1:false,
        statistics_page:'',
        paw_mtk:false,
        uid:'',
    }
  },
   components:{

  },
  created(){
     this.dtheight = window.innerHeight - 405
      
  },
  mounted (){
    
  },
  methods: {
      tj_but(row){
           this.uid = row.uid
           this.statistics_page = ''
           this.post("/member/tokenForLookClient", {
                 uid:this.uid
	       }).then(res => {

              if(res.error_code == 0){
                    this.statistics_page = this.urlwlj + 'pages/user/index' + '?token=' + res.result + '&type=1'
                    this.mtk1 = true
              }else {
                  this.open1(res.message,'warning')
              }
       

            })

     },
     set_but(row){
         this.uid = row.uid
         this.paw_mtk = true
     },
    xg_mm_but(){
   
      


       this.$confirm('此用户将重置登录密码, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            
            this.post("/member/resetLoginPwd", {
            uid:this.uid
	          }).then(res => {

              if(res.error_code == 0){
                  this.open1(res.result,'success')  //提示框
                  this.paw_mtk = false
              }else {
                  this.open1(res.message,'warning')
              }
       

            })
             
        }).catch(() => {
              // this.$message({
              //   type: 'info',
              //   message: '已取消重置密码'
              // });          
        });

     
    },
    xg_ej_but(){
   
       this.$confirm('此用户将重置二级密码, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
            
            this.post("/member/resetSafePwd", {
            uid:this.uid
	          }).then(res => {

              if(res.error_code == 0){
                  this.open1(res.result,'success')  //提示框
                  this.paw_mtk = false
              }else {
                  this.open1(res.message,'warning')
              }
       

            })
             
        }).catch(() => {
              // this.$message({
              //   type: 'info',
              //   message: '已取消重置密码'
              // });          
        });

     
    },
     gogm_but(row){
        this.$router.push({
          path: '/index/addgm',
          query: {
            name:row.telphone,
            id:row.uid
          }
        })
    },
     go_but_1(row){
       this.$router.push({
          path: '/index/distribution',
          query: {
            name:row.telphone,
            id:row.uid
          }
        })
    },
    go_but_2(row){
       this.$router.push({
          path: '/index/records',
          query: {
            name:row.telphone,
            id:row.uid
          }
        })
    },
    goinforpersonal(row,telphone){      
        this.$router.push({
          path: '/index/inforpersonal',
          query: {
            name:telphone,
          }
        })
    }
    // gofp_but(row){
    //     this.$router.push({
    //       path: '/index/manorfp',
    //       query: {
    //         name:"团长",
    //         id:1
    //       }
    //     })
    // },



  }
}
</script>


<style scoped>
.el-dialog__wrapper>>>.el-dialog__body{
    padding:0px 10px 10px 10px;
}
/* .iphone_box{
    background:url('../../assets/images/ipone_bg.png') white  no-repeat; 
    background-size:100% 100%;
    border-radius: 45px;
    padding:5px 0px;
} */

/* .iphone>>>.el-dialog{
    background: none;
    box-shadow: none;
} */
/* .iphone>>>.el-dialog__close{
    font-size: 24px;
    color:white;
} */
</style>